import org.gradle.kotlin.dsl.DependencyHandlerScope

/**
 * 定义一些项目中常用的依赖，方便引用噢。
 */
object AppDependencies {

    private const val androidTestImpl = "androidTestImplementation"
    private const val testImpl = "testImplementation"

    const val appCompat = "androidx.appcompat:appcompat:${Versions.appcompatVersion}"
    const val constraintlayout = "androidx.constraintlayout:constraintlayout:${Versions.constraintLayoutVersion}"
    const val googleMaterial = "com.google.android.material:material:${Versions.materialVersion}"
    const val asynclayoutinflater = "androidx.asynclayoutinflater:asynclayoutinflater:1.0.0"

    val kotlinStdlibDependencies = arrayListOf(
            "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlinVersion}",
            "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlinVersion}",
            "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${Versions.kotlinVersion}"
    )

    val lifecycleAll = arrayListOf<String>(
            "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.archLifecycleVersion}",
            "androidx.lifecycle:lifecycle-livedata-core-ktx:${Versions.archLifecycleVersion}",
            "androidx.lifecycle:lifecycle-livedata-ktx:${Versions.archLifecycleVersion}",
            "androidx.lifecycle:lifecycle-extensions:${Versions.lifecycleExtensionsVersion}",
            "androidx.lifecycle:lifecycle-runtime-ktx:${Versions.archLifecycleVersion}",
            "androidx.lifecycle:lifecycle-common-java8:${Versions.archLifecycleVersion}"
    )

    val appKtxExtension = arrayListOf(
            "androidx.core:core-ktx:${Versions.coreKtxVersion}",
            "androidx.fragment:fragment-ktx:${Versions.fragmentKtxVersion}",
            "androidx.activity:activity-ktx:${Versions.activityKtxVersion}"
    )

    /**
     * 添加单元测试的依赖
     */
    fun addCommonTest(scope: DependencyHandlerScope) {
        scope.add(testImpl, "junit:junit:4.13.2")
        scope.add(androidTestImpl, "junit:junit:4.13.2")
        scope.add(androidTestImpl, "androidx.test.ext:junit:1.1.3")
        scope.add(androidTestImpl, "androidx.test.espresso:espresso-core:3.4.0")
        scope.add(androidTestImpl, "junit:junit:4.13.2")
    }
}